package mychat.vo;

import java.sql.Timestamp;
import java.util.Date;

public class Msg implements Message {

	private String from;
	private String to;
	private String content;
	private int type=Message.NORMAL;
	private int id;
	private Timestamp date;
	
	public String toString() {
		StringBuffer s=new StringBuffer();
		return s.append(type).append(";").append(from).append(";").append(to)
			.append(";").append(date).append(";").append(content).toString();
	}
	

	public Msg(String from, String to, int type, String content) {
		super();
		this.from = from;
		this.to = to;
		this.content = content;
		this.type = type;
		date=new java.sql.Timestamp(new Date().getTime());
	}

	public String getFrom() {
		return from;
	}

	public String getTo() {
		return to;
	}

	public String getContent() {
		return content;
	}

	public int getType() {
		return type;
	}

	public int getId() {
		return id;
	}

	public Date getDate() {
		return date;
	}

	public void setId(int id) {
		this.id=id;
	}

	public void setDate(java.sql.Timestamp date) {
		this.date=date;
	}
	

	

}
